package com.mh.common.core.exception;

import org.apache.poi.ss.formula.functions.T;

import javax.servlet.http.HttpServletResponse;

//业务异常基类
public class CustomException extends RuntimeException {

    private Integer code; //状态码
    private String msg; //响应信息
    private T data; //承载信息
    private Boolean success; //是否成功

    public CustomException() {
    }

    public CustomException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
        //HttpServletResponse.SC_OK = 200
        this.success = HttpServletResponse.SC_OK == code;
    }
    //各种构造,set(),get()
    public CustomException(Integer code, String msg, T data, Boolean success) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.success = success;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

}
